﻿#include <iostream>
#include "SalesItem.h"

int main()
{
    cout << "请输入书籍的信息(ISBN、销量、原价、实际售价):" << endl;
    SalesItem total;
    if (cin >> total) {
        SalesItem trans;
        while (cin >> trans) {
            // 将相同的isbn的数据进行合并
                if (total.isbn() == trans.isbn()) {
                    total.combine(trans);
                }
                else {
                    cout << total << endl;
                    total = trans;
                }
        }
    }
    else {
        cout<<"NO data" << endl;
    }
}